#pragma once

//list class
#include <list>
using std::list;

//string class
#include <string>
using std::string;

/*base class for a scenegraph node*/
class SGNode
{
private:
	//list of children nodes
	list<SGNode*>	_children;

	//name of the node
	string			_name;

public:
	//Constructor
	SGNode();

	//Destructor
	virtual ~SGNode();

	//update the node
	virtual void doUpdate() = 0;

	//preupdate called before the children updates
	virtual void preUpdate();

	//postupdate called after the update of the node
	virtual void postUpdate();

	//add a child to the node
	void addChild(SGNode* child);

	//Traverse the node and its children. This function should never be called outside the tree
	void goThrough();

	//dirty the node (force to recalculate)
	virtual void dirty();

	//set the name of the node
	void setName(const string& name);
};